package com.youfan.control;

import com.youfan.entity.Wuliu;
import com.youfan.page.CommonPage;
import com.youfan.re.Result;
import com.youfan.service.YoufanWuliuServiceImpl;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 消息主控制器
 */
@RestController
@RequestMapping("wuliu")
public class YoufanWuliuController {

    @Resource
    private YoufanWuliuServiceImpl youfanWuliuServiceImpl;

    @RequestMapping(method = RequestMethod.POST,value = "query")
    @ResponseBody
    public Result ansewerQuest(@ApiParam(value = "用户信息必须包含id", required = true) @RequestBody Wuliu wuliu)
    {
        try {
            if (wuliu.getPageNum() == null) {
                wuliu.setPageNum(1);
            }
            if (wuliu.getPageSize() == null) {
                wuliu.setPageSize(5);
            }
            CommonPage<Wuliu> resultdata = youfanWuliuServiceImpl.queryByOrderId(wuliu.getOrderId());
            return Result.success(resultdata, "查询成功");
        } catch (Exception e) {
            e.printStackTrace();
            return Result.fail("查询失败" + e.getMessage());
        }
    }

}
